package net.samsb.tool;

import android.os.Message;

import net.samsb.BaseApplication;
import net.samsb.log.LogUtils;

import static net.samsb.activity.Constants.UPDATE_WS_CONNECT;
import static net.samsb.activity.Constants.WS_RECONNECT;

public class ReconnectionWSErrorThread extends Thread {

    public volatile boolean isStop = false;

    @Override
    public void run() {
        super.run();

        while (!isStop) {
            try {

//                LogUtils.e("ReconnectionWSErrorThread", " --- ReconnectionWSErrorThread 启动 ");

                Thread.sleep(5 * 1000);

                LogUtils.e("getWebSocketMessage", "ERROR_RECONNECT_重连");

                BaseApplication.BaseRequestInstance.getWebSocketRequest().getWebSocketMessage(null);

//                Message msg = new Message();
//                msg.what = UPDATE_WS_CONNECT;
//                msg.obj = "ERROR_RECONNECT";
//                BaseApplication.mHandler
//                        .getHandlerWithName("MainActivity")
//                        .sendMessage(msg);

            } catch (InterruptedException e) {
                e.printStackTrace();
                LogUtils.e("ReconnectionWSErrorThread", " --- ReconnectionWSErrorThread 异常 ");
                return;
            }
        }
    }
}

